import React from 'react';
import { Router, Route, Switch, Redirect } from 'dva/router';
import IndexPage from './pages/Index/IndexPage';
import Course from './pages/Course/Course';
import CourseDetail from './pages/Course/Detail/Detail';
import Mine from "./pages/Course/Mine/Mine";
import Book from './pages/Book/Book';
import BookDetail from './pages/Book/Detail/Detail';
import BookOrder from './pages/Book/BookConfirmOrder/BookConfirmOrder'
import CourseOrder from './pages/Course/CourseConfirmOrder/CourseConfirmOrder'
import Study from "./pages/Study/Study";
// import Test from "./pages/Test/Test";
import Order from "./pages/Order/Order";
import Address from "./pages/Address/Address";
import ShoppingCar from "./pages/ShoppingCar/ShoppingCar";
import ShoppingCarOrder from "./pages/ShoppingCarOrder/CarConfirmOrder/CarConfirmOrder.js";

function RouterConfig({ history }) {
  return (
    <Router history={history}>
      <IndexPage>
        <Switch>
          <Route path="/course" exact component={Course}></Route>
          <Route path="/course/:id" exact component={CourseDetail}></Route>
          <Route path="/myCourse" exact component={Mine}></Route>
          <Route path="/course/order/:id" exact component={CourseOrder}></Route>
          <Route path="/book" exact component={Book}></Route>
          <Route path="/book/:id" exact component={BookDetail}></Route>
          <Route path="/book/order/:id" exact component={BookOrder}></Route>
          <Route path="/study/:id" exact component={Study}></Route>
          {/*<Route path="/test" exact component={Test}></Route>*/}
          <Route path="/order" exact component={Order}></Route>
          <Route path="/address" exact component={Address}></Route>
          <Route path="/shoppingCar" exact component={ShoppingCar}></Route>
          <Route path="/shoppingCar/order" exact component={ShoppingCarOrder}></Route>
          <Redirect from='/' to='/course'></Redirect>
        </Switch>
      </IndexPage>
    </Router>
  );
}

export default RouterConfig;
